//extend()

let obj1 = {
    name:'lili',
    age:18
}

let obj2 = {
    address:'河北省',
    phone:'18210021212',
    age:10
}

// function extend(obj1,obj2){
//     for(let i in obj1){
//         obj2[i] = obj1[i]
//     }
//     return obj2
// }

// extend(obj1,obj2)

//es6  Object.assgin(obj1,obj2....))  合并对象  会修改第一个参数并且把第一个参数返回

// let obj = Object.assign({},obj1,obj2);
// console.log(obj);

//...

// let obj = {...obj1,...obj2};

// console.log(obj);


//Object.is()  判断两个值是否相等  返回值是boolean  


//es5  == === 

// console.log(NaN === NaN)
// console.log(Object.is(NaN,NaN))

// console.log(+0 === -0) 
// console.log(Object.is(+0,-0))

// console.log(Object.is([1,2],[1,2]))

// console.log(Object.is({name:'lili'},{name:'lili'}))

//Object.keys()  values()  entries()

// console.log(Object.entries(obj1))

// for(let i in obj1){
//     console.log(i+'---'+obj1[i])
// }

console.log(Object.getOwnPropertyDescriptor(obj1,'name'))

/*
    {
        configurable: true  //是否可配置
        enumerable: true    //是否可枚举
        value: "lili"       //值
        writable: true      //是否可编辑
    }
*/

//Object.getOwnPropertyDescriptor()  //获取属性的描述对象
//Object.defineProperty()  设置新属性或修改属性的描述对象

Object.defineProperty(obj1,'address',{ //访问器属性
    // writable:false,
    // configurable:false,
    // value:'河北',
    enumerable:true,

    set(val){
        console.log(val)
    },
    get(){
        return '山东'
    }
})

// obj1.address="山西";

// console.log(obj1);

// delete(obj1.name);

for(let i in obj1){
    console.log(i+'---'+obj1[i])
}
// console.log(obj1.address)

// proxy




